package com.foton.logistic.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.foton.logistic.R;
import com.foton.logistic.base.BaseActivity;
import com.foton.logistic.util.IntentUtil;
import com.foton.logistic.util.SharedUtil;
import com.foton.logistic.util.tool.LogUtil;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by macbook on 2018/1/9.
 */

public class CompulSuppleActivity extends BaseActivity {
    @InjectView(R.id.traffic_type_text)
    TextView trafficTypeText;
    @InjectView(R.id.person_info_shop_text)
    TextView personInfoShopText;
    @InjectView(R.id.diveCard_zm_im)
    ImageView diveCardZmIm;
    boolean isAgree = true;
    @InjectView(R.id.ft_ui_register_agree_check)
    TextView agreeText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ft_ui_compul_supple);
        ButterKnife.inject(this);
    }

    @Override
    public void init() {
        setTitleText("强制补充信息");
        setTitleTextVisibility(View.VISIBLE);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK)
            return true;//不执行父类点击事件
        return super.onKeyDown(keyCode, event);
    }

    @OnClick({R.id.traffic_type, R.id.person_info_shop, R.id.jiashi_fy, R.id.ft_ui_register_agree_check, R.id.ft_ui_register_agree, R.id.ft_ui_next})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.traffic_type:
                break;
            case R.id.person_info_shop:
                Intent intent = new Intent(this, SelectActivity.class);
                startActivity(intent);
                break;
            case R.id.jiashi_fy:
                break;
            case R.id.ft_ui_register_agree_check:
                if (isAgree) {
                    agreeText.setSelected(false);
                    isAgree = false;
                } else {
                    agreeText.setSelected(true);
                    isAgree = true;
                }
                break;
            case R.id.ft_ui_register_agree:

                IntentUtil.intent2PrivacyRuler(CompulSuppleActivity.this);
                LogUtil.e("qqqqqqqqqqqqqqqqq");
                break;
            case R.id.ft_ui_next:
               /* if (tel.length()<=0) {
                    OptionUtil.addToast(this, getString(R.string.tip50));
                    return false;
                } else if (!RegexUtil.checkMobile(tel)) {
                    OptionUtil.addToast(this, getString(R.string.tip49));
                    return false;
                }else if (StringUtil.isEmpty(code)) {
                    OptionUtil.addToast(this, getString(R.string.tip44));
                    return false;
                }else if (!code.equals(smsCode)){
                    OptionUtil.addToast(this, getString(R.string.tip51));
                    return false;
                } else if (StringUtil.isEmpty(name)) {
                    OptionUtil.addToast(this, getString(R.string.tip47));
                    return false;
                } else if (StringUtil.isEmpty(sex)){
                    OptionUtil.addToast(this, getString(R.string.tip42));
                    return false;
                }else if (!RegexUtil.checkPassword(password)) {
                    OptionUtil.addToast(this, getString(R.string.pass_check));
                    return false;
                }else if (!password.equals(againPassword)) {
                    OptionUtil.addToast(this, getString(R.string.pass_diff1));
                    return false;
                }else if (!isAgree) {
                    OptionUtil.addToast(this, getString(R.string.tip64));
                    return false;
                }*/
                SharedUtil.saveLogin(this,false);
                break;
        }
    }
}
